﻿using com.hyrentals.common.image;
using com.hyrentals.webportal.Config;
using com.hyrentals.data;
namespace com.hyrentals.webportal.helpers
{
    public class ImageHelper
    {
        public static string GenerateImageUrl(string id, int width, int height, ImageProcessEnum process)
        {
            return ImageConfig.IMAGE_DOWNLOAD_SERVER + ImageUrlHelper.GenerateDownloadUrl(id, width, height, process, "jpg");
        }

        public static string GeneratePhotoUrl(string id)
        {
            return GenerateImageUrl(id, ImageConfig.IMAGE_WIDTH_PHOTO, ImageConfig.IMAGE_HEIGHT_PHOTO, ImageProcessEnum.Cut);
        }

        public static string GenerateRVSmallCoverPhotoUrl(string coverPhotoId)
        {
            if (coverPhotoId != null)
            {
                return GenerateImageUrl(coverPhotoId, ImageConfig.IMAGE_WIDTH_RV_COVER_SMALL, ImageConfig.IMAGE_HEIGHT_RV_COVER_SMALL, ImageProcessEnum.Cut);
            }
            else
            {
                return ImageConfig.IMAGE_CDN_PATH + "default-rv.jpg";
            }
        }

        public static string GenerateUserSmallAvatar(UserBasic user)
        {
            if (user.GenderType == GenderTypeEnum.Male)
            {
                return ImageConfig.IMAGE_CDN_PATH + "male.png";
            }
            else if (user.GenderType == GenderTypeEnum.Female)
            {
                return ImageConfig.IMAGE_CDN_PATH + "female.png";
            }
            else
            {
                return ImageConfig.IMAGE_CDN_PATH + "male.png";
            }
        }
    }
}